package com.trendit.print.sdk.models.printer;

import com.trendit.print.sdk.DaquObject;
import com.trendit.print.sdk.DaquRequest;
import lombok.Data;

import javax.validation.constraints.Max;
import javax.validation.constraints.Min;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Pattern;

/**
 * 播报收银语音请求
 */
@Data
public class PayInVoiceRequest implements DaquRequest<PayInVoiceResponse> {

    private DaquObject bizModel;

    /**
     * 构造方法
     * @param bizModel
     */
    public PayInVoiceRequest(PayInVoiceRequest.Model bizModel) {
        this.bizModel = bizModel;
    }


    @Override
    public String getApiMethodName() {
        return "openapi.playVoice";
    }

    @Override
    public String getApiVersion() {
        return "1.0";
    }

    @Override
    public String getNotifyUrl() {
        return null;
    }

    @Override
    public String getApiMethodURL() {
        return "/openapi/play_voice";
    }

    @Override
    public Class<PayInVoiceResponse> getResponseClass() {
        return PayInVoiceResponse.class;
    }

    @Override
    public DaquObject getBizModel() {
        return bizModel;
    }

    @Override
    public String getBizContent() {
        return null;
    }

    @Data
    public static class Model extends DaquObject {
        /**
         * 请求ID (该值会回原路回传)
         */
        @NotNull
        private String orderId;

        /**
         * 设备编码
         */
        @NotNull
        private String sn;

        /**
         * 收银渠道
         */
        @NotNull
        @Pattern(regexp = "([239]{1})", message = "不支持的收银渠道")
        private String payChannel;

        /**
         * 收银金额（分）
         */
        @NotNull
        private Integer payAmount;

        /**
         * 播报次数
         */
        private Integer voicePlayTimes = 1;

        /**
         * 语音播报间隔
         */
        private Integer voicePlayInterval = 1;

        /**
         * 超时时间：秒
         */
        @Min(10)
        @Max(120)
        private int expiredSec;
    }

}
